﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.Infrastructure
{
    public static class IEnumerableOrderExtensions
    {
        /// <summary>
        /// 设置排序规则.
        /// </summary>
        /// <typeparam name="T">类型.</typeparam>
        /// <param name="query">列表.</param>
        /// <param name="type">排序级别 0-by 1-thenby.</param>
        /// <param name="sort">排序字段.</param>
        /// <param name="order">排序方式 0-升序 1-降序.</param>
        /// <returns>排序后列表.</returns>
        public static IEnumerable<T> SetQueryableOrder<T>(this IEnumerable<T> query, int type, string sort, int order)
        {
            return query.AsQueryable<T>().SetQueryableOrder<T>(type, sort, order);
        }
    }
}
